<?php

class WSB_View_Helper_JsTab
{

    private $_view;

	/**
	 * Erzeugt eine HTML-Tabelle mit clientseitiger Sortierung.
	 *
	 * @param Iterator|array $rowset
	 * @param array $columns
	 * @param array $fields
	 * @param array $settings
	 * @return string
	 */
    public function jsTab($tabs = array())
	{

    	// Javasripte hinzufuegen
    	$javascripts = array(
			WSB_URL . 'WSB/library/WSB/View/Helper/JsTab/tabber-init.js',
			WSB_URL . 'WSB/library/WSB/View/Helper/JsTab/tabber.js'
    	);
    	foreach($javascripts AS $src) {
    		$this->_view->headScript()->offsetSetFile($src, $src);
    	}

    	// Stylesheets hinzufuegen
    	$stylesheets = array(
			WSB_URL . 'WSB/library/WSB/View/Helper/JsTab/tabber.css'
    	);
    	foreach($stylesheets AS $link) {
    		$this->_view->headLink()->offsetSetStylesheet($link, $link);
    	}

		$html = '';
		$html .= '<div class="tabber" id="' . 5 . '"' . $this->buildHtmlAttributes() . '>';
		foreach($tabs AS $label=>$content) {
			$html .= '<div class="tabbertab">';
			$html .= '<h2>' . $label . '</h2>';
			$html .= $content;
			$html .= '</div>';
		}
		$html .= '</div>';
		return $html;

    }

    private function buildHtmlAttributes()
	{

    }

    /**
     * Setze View Objekt. Diese Methode wird beim ersten Instanzieren aufgerufen.
     *
     * @param Zend_View_Interface $view
     */
    public function setView(Zend_View_Interface $view)
    {
        $this->_view = $view;
    }

}
